package com.chennan.websocket.domain.model;

import lombok.Data;

import javax.security.auth.Subject;
import java.security.Principal;

/**
 * @author chennan
 * @createTime 2021年08月02日 10:41:00
 */
@Data
public class User implements Principal {

    private String username;

    private String password;

    private String role;

//    private List<Url> urls;

    @Override
    public String getName() {
        return this.username;
    }

    @Override
    public boolean implies(Subject subject) {
        if (subject == null){
            return false;
        }

        return subject.getPrincipals().contains(this);
    }
}
